<script type="text/javascript">
var refreshId = setInterval(function(){
     $('#wapper-content').load('encherehome.php');
}, 1000);
</script>

<?php if(!empty($enchersUne)): ?>
    <div id="une">
    <?php foreach($enchersUne as $enchers):  ?>
		<div class="iconsu">
			<div class="iconu">
				<span class="rt"><?php echo $enchers->getRetime(); ?></span>
			</div>
			<div class="iconu">
				<span class="pc<?php echo $pc  ?>"><?php  echo $enchers->getLimite(); ?>%</span>
			</div>
			<div class="iconu">
				<span class="ae<?php echo $ae  ?>"><?php  echo $enchers->getAe(); ?></span>
			</div>
		</div>
		<div class="titreu"><?php  echo $enchers->getNom(); ?></div>
		<div id="effect<?php  echo $enchers->getId(); ?>">
			<a href="detail-product-<?php  echo $enchers->getId(); ?>.html">
				<div class="imageu"><img src="<?php  echo _UPLOAD_DIR_ ?>encheres/meduim<?php  echo $enchers->getImages()?>" alt="<?php  echo $enchers->getNom(); ?>" title="<?php  echo $enchers->getNom(); ?>" /></div>
			</a>
		</div>
		<div class="temps">
			<?php if( $site->getHourClose() <= date('H:i:s') OR $site->getHourOpen() >= date('H:i:s')): ?>
                EN PAUSE
			<?php else: ?>
                <?php echo $timeEn ?>
			<?php endif; ?>
		</div>
		<div class="enchere<?php echo (float)$enchers->getEnchere()>(float)($enchers->getPrix()*$enchers->getLimite()/100)?' enchere_g':'' ?>"><?php  echo $enchers->getEnchere(); ?> <?php  echo $site->getDevise(); ?></div>
		<div class="prixu">
			<?php echo _PRIX_MAGASIN_ ?><?php  echo $enchers->getPrix(); ?> <?php  echo $site->getDevise(); ?><br />
			<span class="meneuru">
                <?php if($timeEn == _TERMINE_): ?>
                    <?php echo _GAGNANT_ ?>
                <?php else: ?>
                    <?php echo _MENEUR_; ?>
                <?php endif; ?>
            </span>
            <span class="pseudou"><?php  echo $enchers->getPseudo(); ?></span>
		</div>
        <div class="encheriru">
            <?php if( $site->getHourClose() <= date('H:i:s') OR $site->getHourOpen() >= date('H:i:s')): ?>
                <img src="<?php  echo _THEME_IMG_DIR_ ?>bt-avenir.jpg" alt="Indisponible" />
            <?php else: ?>
                <?php if($timeEn == _TERMINE_): ?>
                    <img src="<?php  echo _THEME_IMG_DIR_ ?>bt-termine.jpg" alt="Indisponible" />
                <?php elseif($user->isAuthenticated() AND $enchers->getMeneur() == $user->getId()): ?>
                    <img src="<?php  echo _THEME_IMG_DIR_ ?>bt-meneur.jpg" alt="Meneur" />
                <?php else: ?>
                    <a class="encherir-elt" href="#" id="encherir-<?php  echo $enchers->getId().'-'.($user->isAuthenticated()?intval($user->getId()):0); ?>"><img src="<?php  echo _THEME_IMG_DIR_ ?>encherir.jpg" alt="Ench&eacute;rir" /></a>
                <?php endif; ?>
            <?php endif; ?>
		</div>
    <?php endforeach;?>
    </div>
<?php else:?>
    <div id="une"><p><?php echo _AUCUNE_ENCHERE_UNE_; ?></p></div>
<?php endif;?>
<?php if(!empty($listenchere)):?>
    <?php foreach ($listenchere as $data):?>
        <div class="cours">
            <div class="icons">
                <div class="icon">
                    <span class="rt"><?php  echo $data['retime']; ?></span>
                </div>
                <div class="icon">
                    <span class="pc<?php  echo $data['pc']; ?>"><?php  echo $data['limite']; ?>%</span>
                </div>
                <div class="icon">
                    <span class="ae<?php  echo $data['ae']; ?>"><?php  echo $data['AE']; ?></span>
                </div>
            </div>
            <div class="content-img">
                <div class="titre"><?php  echo $data['nom']; ?></div>
                <div id="effect<?php  echo $data['id']; ?>">
                    <div class="image">
                        <a href="detail-product-<?php  echo $data['id']; ?>.html">
                            <img src="<?php  echo _UPLOAD_DIR_ ?>encheres/small<?php  echo $data['images']; ?>" alt="<?php  echo $data['nom']; ?>" title="<?php  echo $data['nom']; ?>"/>
                        </a>
                    </div>
                </div>
            </div>
            <div class="temps">
			<?php if( $site->getHourClose() <= date('H:i:s') OR $site->getHourOpen() >= date('H:i:s')): ?>
                EN PAUSE
			<?php else: ?>
                <?php echo $data['timeEn'] ?>
			<?php endif; ?>
			</div>
            <div class="enchere<?php echo (float)$data['enchere']>(float)( $data['prix']*$data['limite']/100)?' enchere_g':'' ?>"><?php  echo $data['enchere']; ?> <?php  echo $site->getDevise(); ?></div>
            <div class="encherir">
			<?php if( $site->getHourClose() <= date('H:i:s') OR $site->getHourOpen() >= date('H:i:s')): ?>
                <img src="<?php  echo _THEME_IMG_DIR_ ?>bt-avenir.jpg" alt="Indisponible" />
            <?php else: ?>
                <?php if($data['timeEn'] == _TERMINE_): ?>
                    <img src="<?php  echo _THEME_IMG_DIR_ ?>bt-termine.jpg" alt="Indisponible" />
                <?php elseif($user->isAuthenticated() AND $data['meneur'] == $user->getId()): ?>
                    <img src="<?php  echo _THEME_IMG_DIR_ ?>bt-meneur.jpg" alt="Meneur" />
                <?php else: ?>
                    <a class="encherir-elt" href="#" id="encherir-<?php  echo $data['id'].'-'.($user->isAuthenticated()?intval($user->getId()):0); ?>"><img src="<?php  echo _THEME_IMG_DIR_ ?>encherir.jpg" alt="Ench&eacute;rir" /></a>
                <?php endif; ?>
            <?php endif; ?>
			</div>
            <div class="infos">
                <span class="prix"><?php echo _PRIX_MAGASIN_ ?><?php  echo $data['prix']; ?> <?php  echo $site->getDevise(); ?></span>
                <span class="meneur">
				<?php if($data['timeEn'] == _TERMINE_): ?>
                    <?php echo _GAGNANT_ ?>
                <?php else: ?>
                    <?php echo _MENEUR_; ?>
                <?php endif; ?>
				</span>
                <span class="pseudo"><?php  echo $data['pseudo']; ?></span>
            </div>
        </div>
    <?php endforeach; ?>
<?php else:?>
    <div class="cours"><p><?php echo _AUCUNE_ENCHERE_EN_COURS_; ?></p></div>
<?php endif; ?>
